home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 7 / Amiga Format AFCD07 (Dec 1996, Issue 91).iso / serious / shareware / programming / aros / dos / isinteractive.c < prev    next >
C/C++ Source or Header  |  1996-09-12  |  2KB  |  90 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: isinteractive.c,v 1.3 1996/08/13 13:52:48 digulla Exp $
  4.     $Log: isinteractive.c,v $
  5.     Revision 1.3  1996/08/13 13:52:48  digulla
  6.     Replaced <dos/dosextens.h> by "dos_intern.h" or added "dos_intern.h"
  7.     Replaced __AROS_LA by __AROS_LHA
  8.  
  9.     Revision 1.2  1996/08/01 17:40:53  digulla
  10.     Added standard header for all files
  11.  
  12.     Desc:
  13.     Lang: english
  14. */
  15. #include <clib/exec_protos.h>
  16. #include <dos/filesystem.h>
  17. #include "dos_intern.h"
  18.  
  19. /*****************************************************************************
  20.  
  21.     NAME */
  22.     #include <clib/dos_protos.h>
  23.  
  24.     __AROS_LH1(BOOL, IsInteractive,
  25.  
  26. /*  SYNOPSIS */
  27.     __AROS_LHA(BPTR, file, D1),
  28.  
  29. /*  LOCATION */
  30.     struct DosLibrary *, DOSBase, 36, Dos)
  31.  
  32. /*  FUNCTION
  33.     Check if file is bound to an interactive device such as a console
  34.     or shell window.
  35.  
  36.     INPUTS
  37.     file   - filehandle
  38.  
  39.     RESULT
  40.     !=0 if the file is interactive, 0 if it is not.
  41.  
  42.     NOTES
  43.  
  44.     EXAMPLE
  45.  
  46.     BUGS
  47.  
  48.     SEE ALSO
  49.  
  50.     INTERNALS
  51.  
  52.     HISTORY
  53.     29-10-95    digulla automatically created from
  54.                 dos_lib.fd and clib/dos_protos.h
  55.  
  56. *****************************************************************************/
  57. {
  58.     __AROS_FUNC_INIT
  59.     __AROS_BASE_EXT_DECL(struct DosLibrary *,DOSBase)
  60.  
  61.     /* Get pointer to filehandle */
  62.     struct FileHandle *fh=(struct FileHandle *)BADDR(file);
  63.  
  64.     /* Get pointer to process structure */
  65.     struct Process *me=(struct Process *)FindTask(NULL);
  66.  
  67.     /* Get pointer to I/O request. Use stackspace for now. */
  68.     struct IOFileSys io,*iofs=&io;
  69.  
  70.     /* Prepare I/O request. */
  71.     iofs->IOFS.io_Message.mn_Node.ln_Type=NT_REPLYMSG;
  72.     iofs->IOFS.io_Message.mn_ReplyPort     =&me->pr_MsgPort;
  73.     iofs->IOFS.io_Message.mn_Length     =sizeof(struct IOFileSys);
  74.     iofs->IOFS.io_Device =fh->fh_Device;
  75.     iofs->IOFS.io_Unit     =fh->fh_Unit;
  76.     iofs->IOFS.io_Command=FSA_IS_INTERACTIVE;
  77.     iofs->IOFS.io_Flags  =0;
  78.  
  79.     /* Send the request. */
  80.     DoIO(&iofs->IOFS);
  81.  
  82.     /* Return */
  83.     if(iofs->io_DosError)
  84.     return 0;
  85.     else
  86.     return iofs->io_Args[0];
  87.  
  88.     __AROS_FUNC_EXIT
  89. } /* IsInteractive */
  90.